<?php
/*
** The default language is frensh
** The name of the Xml file is in xmlName set on the constructor
*/
class Language
{
	private $xml;
	private $xmlName;
	private $idLangue;
		
	function __construct() {
		$this->xml = null;
        $this->xmlName = "text/qualitymonitoring_";
		$this->idLangue = "FR";
    }
	
	public function translate($id_texte)
	{
		if (file_exists($this->xmlName . $this->idLangue . ".xml"))
		{
			$this->xml = new SimpleXMLElement($this->xmlName . $this->idLangue . ".xml", null, true);
			foreach ($this->xml->part as $txt) {
				foreach ($txt as $content)
				{
					if ($content->attributes() == $id_texte)
						return $content;
				}
			}
		}
		else 
			return "File not found.<br/>";
	}
	
	public function changeLanguage($id_langue)
	{
		$this->idLangue = $id_langue;
	}
}
?>